package com.activity.Interface;

import com.activity.gaswatchermtl.R;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class SplashActivity extends Activity {

	private static final int STOPSPLASH = 0;

    /**
     * Default duration for the splash screen (milliseconds)
     */
	private static final long SPLASHTIME = 2000; 

    /**
     * Handler to close this activity and to start automatically {@link MainActivity}
     * after <code>SPLASHTIME</code> seconds.
     */
 	private final transient Handler splashHandler = new Handler()
    {
        @Override
        public void handleMessage(Message msg)
        {
 
        	if (msg.what == STOPSPLASH)
            {
        		final Intent intent = new Intent(SplashActivity.this, ChoixLogin.class);
                startActivity(intent);
                finish();
            }

        	super.handleMessage(msg);
 
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
		 super.onCreate(savedInstanceState);
		 setContentView(R.layout.activity_splash);
		 
		 final Message msg = new Message();
		 msg.what = STOPSPLASH;
		 splashHandler.sendMessageDelayed(msg, SPLASHTIME);
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_splash, menu);
		return true;
	}

}
